<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../js/formatDate.js"></script>
</head>

<body>
    <ul>
        <li>01</li>
        <li>02</li>
        <li>03</li>
        <li>04</li>
        <li>05</li>
        <li>06</li>
    </ul>

    <form action="">
        <div class="input-group">
            <label for="user">用户名:</label>
            <input type="text" id="user" name="user">
        </div>
        <div class="input-group">
            <label for="">密&emsp;码:</label>
            <input type="text" name="pwd">
        </div>
        <div class="input-group">
            <span>爱&emsp;好:</span>
            <label><input type="checkbox" name="hobby">唱歌</label>
            <label><input type="checkbox" name="hobby">跳舞</label>
            <label><input type="checkbox" name="hobby">Rap</label>
            <label><input type="checkbox" name="hobby">篮球</label>
        </div>
    </form>
</body>
<script>
    // window的子对象 (BOM相关)

    // document对象的方法
    // document.getElementById()   通过id名获取
    // document.getElementsByClassName()  通过class名获取
    // document.getElementsByTagName()    通过标签名获取
    // document.getElementsByName()       通过name属性获取 (一般用于表单元素)
    // document.write()

    // var liList = document.getElementsByTagName("li");
    // console.log(liList);

    // var all = document.getElementsByTagName("*");
    // console.log(all);

    var hobbyList = document.getElementsByName("hobby");
    console.log(hobbyList);

    var userInp = document.getElementsByName("user")[0];
    console.log(userInp);

</script>

</html>